webpackJsonp([46],{

/***/ "LCxJ":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/core-js/promise.js
var promise = __webpack_require__("rVsN");
var promise_default = /*#__PURE__*/__webpack_require__.n(promise);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__("KH7x");
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/extends.js
var helpers_extends = __webpack_require__("4YfN");
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/router/index.js + 16 modules
var router = __webpack_require__("YaEn");

// EXTERNAL MODULE: ./src/store/index.js
var store = __webpack_require__("IcnI");

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./src/common/utils/index.js
var utils = __webpack_require__("dh3M");

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/common/anjian/message/index.vue





//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//






/* harmony default export */ var message = ({
  data: function data() {
    var _this = this;

    return {
      searchApiFirst: function () {
        var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee(_ref2) {
          var skip = _ref2.skip,
              limit = _ref2.limit;

          var query, options, p, _ref3, _ref4, department, data;

          return regenerator_default.a.wrap(function _callee$(_context) {
            while (1) {
              switch (_context.prev = _context.next) {
                case 0:
                  query = _this.getQueryOptions('WJ_notice_bulletin_records', true);
                  options = extends_default()({
                    skip: skip,
                    limit: limit,
                    include: ['records', 'records_gov'],
                    descending: ['createdAt']
                  }, query);
                  p = [commonApi["a" /* commonApi */].dictionary('sending_department'), commonApi["a" /* commonApi */].search('WJ_notice_bulletin', options)];
                  _context.prev = 3;
                  _context.next = 6;
                  return promise_default.a.all(p);

                case 6:
                  _ref3 = _context.sent;
                  _ref4 = slicedToArray_default()(_ref3, 2);
                  department = _ref4[0];
                  data = _ref4[1];
                  return _context.abrupt('return', Object(utils["d" /* ReplaceDictionary */])(data, { sending_department: department }));

                case 13:
                  _context.prev = 13;
                  _context.t0 = _context['catch'](3);

                  _this.handleFetchError(_context.t0);
                  return _context.abrupt('return', []);

                case 17:
                case 'end':
                  return _context.stop();
              }
            }
          }, _callee, _this, [[3, 13]]);
        }));

        return function searchApiFirst(_x) {
          return _ref.apply(this, arguments);
        };
      }(),
      searchApiSecond: function () {
        var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2(_ref6) {
          var skip = _ref6.skip,
              limit = _ref6.limit;

          var query, options, p, _ref7, _ref8, department, data;

          return regenerator_default.a.wrap(function _callee2$(_context2) {
            while (1) {
              switch (_context2.prev = _context2.next) {
                case 0:
                  query = _this.getQueryOptions('WJ_send_files_record');
                  options = extends_default()({
                    skip: skip,
                    limit: limit,
                    include: ['records', 'records_gov'],
                    descending: ['createdAt']
                  }, query);
                  p = [commonApi["a" /* commonApi */].dictionary('sending_department'), commonApi["a" /* commonApi */].search('WJ_send_files', options)];
                  _context2.prev = 3;
                  _context2.next = 6;
                  return promise_default.a.all(p);

                case 6:
                  _ref7 = _context2.sent;
                  _ref8 = slicedToArray_default()(_ref7, 2);
                  department = _ref8[0];
                  data = _ref8[1];
                  return _context2.abrupt('return', Object(utils["d" /* ReplaceDictionary */])(data, { sending_department: department }));

                case 13:
                  _context2.prev = 13;
                  _context2.t0 = _context2['catch'](3);

                  _this.handleFetchError(_context2.t0);
                  return _context2.abrupt('return', []);

                case 17:
                case 'end':
                  return _context2.stop();
              }
            }
          }, _callee2, _this, [[3, 13]]);
        }));

        return function searchApiSecond(_x2) {
          return _ref5.apply(this, arguments);
        };
      }(),
      searchApiThird: function () {
        var _ref9 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee3(_ref10) {
          var skip = _ref10.skip,
              limit = _ref10.limit;

          var query, options, p, _ref11, _ref12, department, data;

          return regenerator_default.a.wrap(function _callee3$(_context3) {
            while (1) {
              switch (_context3.prev = _context3.next) {
                case 0:
                  query = _this.getQueryOptions('WJ_conference_record');
                  options = extends_default()({
                    skip: skip,
                    limit: limit,
                    include: ['records', 'records_gov'],
                    descending: ['createdAt']
                  }, query);
                  p = [commonApi["a" /* commonApi */].dictionary('sending_department'), commonApi["a" /* commonApi */].search('WJ_conference_notice', options)];
                  _context3.prev = 3;
                  _context3.next = 6;
                  return promise_default.a.all(p);

                case 6:
                  _ref11 = _context3.sent;
                  _ref12 = slicedToArray_default()(_ref11, 2);
                  department = _ref12[0];
                  data = _ref12[1];
                  return _context3.abrupt('return', Object(utils["d" /* ReplaceDictionary */])(data, { sending_department: department }));

                case 13:
                  _context3.prev = 13;
                  _context3.t0 = _context3['catch'](3);

                  _this.handleFetchError(_context3.t0);
                  return _context3.abrupt('return', []);

                case 17:
                case 'end':
                  return _context3.stop();
              }
            }
          }, _callee3, _this, [[3, 13]]);
        }));

        return function searchApiThird(_x3) {
          return _ref9.apply(this, arguments);
        };
      }(),
      page: 0,
      pageList: [{ text: '公告' }, { text: '收发文' }, { text: '会议' }]
    };
  },

  watch: {
    page: function page() {
      var _this2 = this;

      setTimeout(function () {
        _this2.$refs['group' + _this2.page].startPull();
      }, 30);
    }
  },
  activated: function activated() {
    this.initData();
  },

  methods: {
    onDetail: function onDetail(data) {
      var recordId = this.getRecordId(data);
      this.$router.$push({
        path: '/message/detail',
        query: { id: data.id, recordId: recordId }
      });
    },
    onDetailFile: function onDetailFile(data) {
      var recordId = this.getRecordId(data);
      this.$router.$push({
        path: '/message/detail-file',
        query: { id: data.id, recordId: recordId }
      });
    },
    onDetailMeeting: function onDetailMeeting(data) {
      var recordId = this.getRecordId(data);
      this.$router.$push({
        path: '/message/detail-meeting',
        query: { id: data.id, recordId: recordId }
      });
    },
    tabsChange: function tabsChange(page) {
      this.page = page;
    },
    initData: function initData() {
      var _this3 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee4() {
        var p, res;
        return regenerator_default.a.wrap(function _callee4$(_context4) {
          while (1) {
            switch (_context4.prev = _context4.next) {
              case 0:
                p = [commonApi["a" /* commonApi */].searchCount('WJ_notice_bulletin', _this3.getQueryOptions('WJ_notice_bulletin_records', true)), commonApi["a" /* commonApi */].searchCount('WJ_send_files', _this3.getQueryOptions('WJ_send_files_record')), commonApi["a" /* commonApi */].searchCount('WJ_conference_notice', _this3.getQueryOptions('WJ_conference_record'))];
                _context4.prev = 1;
                _context4.next = 4;
                return promise_default.a.all(p);

              case 4:
                res = _context4.sent;

                _this3.pageList = _this3.pageList.map(function (v, index) {
                  return extends_default()({}, v, {
                    badge: { value: res[index] }
                  });
                });
                _context4.next = 11;
                break;

              case 8:
                _context4.prev = 8;
                _context4.t0 = _context4['catch'](1);

                _this3.handleFetchError(_context4.t0);

              case 11:
              case 'end':
                return _context4.stop();
            }
          }
        }, _callee4, _this3, [[1, 8]]);
      }))();
    },
    getQueryOptions: function getQueryOptions(collectionName, flag) {
      try {
        var query = Object(store["d" /* JudgeRole */])().enterprise(function () {
          var id = (Object(store["c" /* GetStore */])(store["f" /* Store */].enterprise) || {}).id;
          return {
            matchesQuery: {
              records: commonApi["a" /* commonApi */].createQueryIncludeOptions(collectionName, {
                equalTo: {
                  enterpriseId: id
                },
                containedIn: {
                  state: flag ? [0] : [0, 1]
                }
              })
            }
          };
        }).government(function () {
          var id = (Object(store["c" /* GetStore */])(store["f" /* Store */].organization) || {}).id;
          return {
            matchesQuery: {
              records_gov: commonApi["a" /* commonApi */].createQueryIncludeOptions(collectionName, {
                equalTo: {
                  gov_org: id
                },
                containedIn: {
                  state: flag ? [0] : [0, 1]
                }
              })
            }
          };
        }).default();
        return query;
      } catch (e) {
        this.handleFetchError(e);
      }
    },
    getRecordId: function getRecordId(data) {
      var recordId = Object(store["d" /* JudgeRole */])().enterprise(function () {
        var id = (Object(store["c" /* GetStore */])(store["f" /* Store */].enterprise) || {}).id;
        var record = data.records.find(function (v) {
          return v.attributes.enterpriseId.id === id;
        });
        return record ? record.id : '';
      }).government(function () {
        var id = (Object(store["c" /* GetStore */])(store["f" /* Store */].organization) || {}).id;
        var record = data.records_gov.find(function (v) {
          return v.attributes.gov_org.id === id;
        });
        return record ? record.id : '';
      }).default();
      return recordId;
    },
    handleFetchError: function handleFetchError(e) {
      if (e.code === 119 && e.message === "anonymous  user isn't allowed to perform the find operation.") {
        router["a" /* default */].push({
          path: '/login',
          query: {
            client: 'weixin',
            path: '/message'
          }
        });
      }
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-4c12340a","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/common/anjian/message/index.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"title":"最新通知","scroll":""}},[_c('yt-buttonTab',{attrs:{"slot":"title","list":_vm.pageList},on:{"change":_vm.tabsChange},slot:"title"}),_vm._v(" "),_c('yt-form',{directives:[{name:"show",rawName:"v-show",value:(_vm.page === 0),expression:"page === 0"}]},[_c('yt-group',{ref:"group0",attrs:{"searchApi":_vm.searchApiFirst},scopedSlots:_vm._u([{key:"default",fn:function(scope){return _c('yt-card',{attrs:{"title":scope.bulletin_title,"tag":false,"edge":false}},[_c('span',{attrs:{"slot":"more"},slot:"more"},[_vm._v(_vm._s(scope.sending_department))]),_vm._v(" "),_c('p',{staticClass:"content"},[_vm._v(_vm._s(scope.bulletin_content))]),_vm._v(" "),_c('div',{staticClass:"footer",on:{"click":function($event){return _vm.onDetail(scope)}}},[_c('span',[_vm._v("查看信息")])])])}}])})],1),_vm._v(" "),_c('yt-form',{directives:[{name:"show",rawName:"v-show",value:(_vm.page === 1),expression:"page === 1"}]},[_c('yt-group',{ref:"group1",attrs:{"searchApi":_vm.searchApiSecond},scopedSlots:_vm._u([{key:"default",fn:function(scope){return _c('yt-card',{attrs:{"title":scope.number,"tag":false,"edge":false}},[_c('span',{attrs:{"slot":"more"},slot:"more"},[_vm._v(_vm._s(scope.sending_department))]),_vm._v(" "),_c('p',{staticClass:"content"},[_vm._v(_vm._s(scope.title))]),_vm._v(" "),_c('div',{staticClass:"footer",on:{"click":function($event){return _vm.onDetailFile(scope)}}},[_c('span',[_vm._v("查看信息")])])])}}])})],1),_vm._v(" "),_c('yt-form',{directives:[{name:"show",rawName:"v-show",value:(_vm.page === 2),expression:"page === 2"}]},[_c('yt-group',{ref:"group2",attrs:{"searchApi":_vm.searchApiThird},scopedSlots:_vm._u([{key:"default",fn:function(scope){return _c('yt-card',{attrs:{"title":("会议时间：" + (scope.meeting_start_time)),"tag":false,"edge":false}},[_c('span',{attrs:{"slot":"more"},slot:"more"},[_vm._v(_vm._s(scope.sending_department))]),_vm._v(" "),_c('p',{staticClass:"content"},[_vm._v(_vm._s(scope.title))]),_vm._v(" "),_c('div',{staticClass:"footer",on:{"click":function($event){return _vm.onDetailMeeting(scope)}}},[_c('span',[_vm._v("查看信息")])])])}}])})],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var anjian_message = (esExports);
// CONCATENATED MODULE: ./src/common/anjian/message/index.vue
function injectStyle (ssrContext) {
  __webpack_require__("VYVv")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-4c12340a"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  message,
  anjian_message,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var common_anjian_message = __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ "VYVv":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ })

});